import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('component', { schema: 'db_lowcode' })
export class Component {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: '组件ID' })
  id: number;

  @Column('tinyint', { name: 'type', comment: '组件类型' })
  type: number;

  @Column('int', { name: 'page_id', comment: '页面ID' })
  pageId: number;

  @Column('int', { name: 'account_id', comment: '账户ID' })
  accountId: number;

  @Column('text', { name: 'options', comment: '组件选项' })
  options: string;

  @Column('tinyint', {
    name: 'status',
    comment: '状态1 启用 0 禁用',
    width: 1,
    default: () => "'1'",
  })
  status: boolean;

  @Column('timestamp', {
    name: 'create_time',
    comment: '创建时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createTime: Date;

  @Column('timestamp', {
    name: 'update_time',
    comment: '更新时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  updateTime: Date;
}
